<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // JS很多类型都可以通过构造函数创建
    // 对象
    let o=new Object();
    o.name='小灰';
    console.log(o);

// 数值
    let n=new Number(1);
    console.log(n+3);

// 字符串
    let s=new String('xiaohui');
    console.log(s.valueOf());
    console.log(s.toLocaleUpperCase);

//   布尔  
    let b=new Boolean(true);
    console.log(typeof b.toString());
    console.log(typeof b.valueOf());
// 正则表达式    
    let r=new RegExp("\\d+");
    console.log(r.valueOf());
    console.log(r.test('abc'));
// 函数
    function name() {};
    let User=new Function(
        "name",`this.name=name;this.show=function(){console.log(this.name)}`
    )
    
    let xh=new User('刘辉');
    xh.show()
    
    
</script>
</html>